<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{padding: 0;margin: 0;}
        .box{
            width: 150px;
            height: 150px;
            background-color: #6ff;
            margin: 100px;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
<script>
    // 鼠标相关的事件
    // onclick       鼠标单击(鼠标左键 按下之后在松开)  
    // ondblclick    鼠标双击(鼠标左键 双击后在松开)
    // onmousedown   鼠标按下
    // onmousemove   鼠标移动
    // onmouseup     鼠标松开

    // onmouseover   鼠标划入
    // onmouseout    鼠标划出



    var box = document.getElementsByClassName("box")[0];
    console.dir(box);

    // 鼠标单击(鼠标左键 按下之后在松开)  
    // box.onclick = function(){
    //     console.log("click");
    // }

    // 鼠标双击(鼠标左键 双击后在松开)
    // box.ondblclick = function(){
    //     console.log("dblclick");
    // }

    // onmousedown   鼠标按下
    // box.onmousedown = function(event){  // e evt event对象(事件发生时相关的信息)
    //     console.log("mousedown",event.button);   // 左(0)  中(1)  右 (2)
    //     // console.log(event);
    // }
    
    // onmouseup     鼠标松开
    // box.onmouseup = function(){
    //     console.log("mouseup");
    // }

    // onmousemove   鼠标移动
    // box.onmousemove = function(){
    //     console.log("mousemove");
    // }

    box.onmouseover = function(){
        console.log("mouseover ");
    }
    box.onmouseout = function(){
        console.log("mouseout");
    }





</script>
</html>